using UnityEngine;
using System.Collections;
using LogicalComponent.util;

public class MouseUI : MonoBehaviour {

    public GameObject manager;

    // Use this for initialization
	void Start () {
        if(manager.Equals(null)){
            manager = GameObject.FindGameObjectWithTag("GameManager");
        }
	}

	// Update is called once per frame
	void Update () {
        if (Input.GetButtonDown ("Fire1"))
        {
            /// Construct a ray from the current mouse coordinates
            Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            RaycastHit hit;
                if (Physics.Raycast(ray, out hit)) {
                    manager.SendMessage("MouseClick",hit,SendMessageOptions.DontRequireReceiver);
	            }
        }
    }
}
